#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param num int整型vector 
     * @return int整型vector<vector<>>
     */
    void dfs(vector<vector<int> >& res, vector<int>&num, vector<int>&tmp, bool* vis, int cur){
        if(cur == num.size()){
            for(int i = 0; i < tmp.size(); i++){
                cout<<tmp[i]<< " ";
            }
            cout<<endl;
            res.push_back(tmp);
            return;
        }
        for(int i = 0; i < num.size(); i++){
            if(!vis[i]){
                cout<<"i:"<<i<<" num:"<<num[i]<<endl;
                tmp.push_back(num[i]);
                vis[i] = true;
                dfs(res, num, tmp, vis, cur+1);
                tmp.pop_back();
                vis[i] = false;
            }
        }
    }
    vector<vector<int> > permute(vector<int>& num) {
        // write code here
        vector<vector<int> > res;
        vector<int> tmp;
        bool* vis = new bool[num.size()];
        dfs(res, num, tmp, vis, 0);
        return res;
    }
};

int main()
{
    Solution s;
    vector<int> num;
    num.push_back(0);
    num.push_back(1);
    s.permute(num);
}